package com.zzh.jn_erp.manufacturermanagerweb.controller;

import com.github.pagehelper.Page;
import com.zzh.jn_erp.common.UnifyResult;
import com.zzh.jn_erp.manufacturermanagerweb.entity.Manufacturer;
import com.zzh.jn_erp.manufacturermanagerweb.service.ManufacturerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author zhouzh
 * @date 2021/3/20 16:35
 * @description
 */
@RestController
@RequestMapping("/manufacturer")
public class ManufacturerController {

    @Autowired
    private ManufacturerService manufacturerService;

    /**
     * 跳转供应商管理
     * @return
     */
    @GetMapping("/manufacturerManagerWeb")
    public ModelAndView toLoginWeb(){
        return new ModelAndView("/manufacture/manufacturer.list");
    }

    @PostMapping("dataList")
    public UnifyResult dataList(Manufacturer manufacturer) {
        Page<Manufacturer> infoList = manufacturerService.dataList(manufacturer);
        return UnifyResult.success().data("data", infoList);
    }
}
